package com.feng.swing.tools.listener;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JFrame;
import javax.swing.JMenuItem;
import javax.swing.JPanel;

import com.feng.swing.tools.ui.HttpPanel;
import com.feng.swing.tools.ui.MainFrame;

public class MainFrameListener implements ActionListener{
	MainFrame view = null;
	public MainFrameListener(JFrame frame) {
		view = (MainFrame) frame;
	}
	@Override
	public void actionPerformed(ActionEvent e) {
		System.out.println(">>>Name:"+e.getSource().toString());
		JMenuItem menuItem = (JMenuItem)e.getSource();
		if(menuItem.getText().equals(view.httpTestMenuItem1.getText())){
			//show http tools ui
			JPanel p = new HttpPanel();
			p.setVisible(true);
			view.setLayout(p.getLayout());
			view.add(p);
		}
	}
}
